package com.farm.quartz.Dao;

import com.farm.quartz.model.haohao;
import com.farm.quartz.model.wuDepInfo;
import com.farm.quartz.model.wuLawPer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;

public interface wuLawPerDao extends JpaRepository<wuLawPer,Integer> {
    //根据id查询
    wuLawPer getById(int id);
    //查询所有数据
    ArrayList<wuLawPer> findAll();
    //根据名字查询，暂时未用
    wuLawPer findByName(wuLawPer wulawper);
    //删除操作

    @Modifying
    @Transactional
    @Query(value="delete from wu_law_per  where id = ?", nativeQuery = true)
    Integer delete(int id);

    @Modifying
    @Transactional
    @Query(value="update wu_law_per set age = ?1 ,sex = ?2, name = ?3 where id = ?4", nativeQuery = true)
    Integer update(String age,String sex,String name,int id);


    List<wuLawPer> findAllBy(Pageable pageable);
    int countAllBy();








}